X ID Alter Global Overview Cardinal AffiliativeQ_average item3
1 0 365 37 5.6 6.285714 2.5 5.2 2
2 1 3572 23 5.7 3.142857 1.0 4.0 2
3 2 3572 23 5.7 3.142857 1.0 4.0 2
4 3 3572 23 5.7 3.142857 1.0 4.0 2
5 4 3572 23 5.7 3.142857 1.0 4.0 2
6 5 3572 23 5.7 3.142857 1.0 4.0 2
ContextQ_average remember_action_likert remember_standing_likert
1 3.5 2.714286 1.107143
2 4.5 2.250000 1.714286
3 4.5 2.250000 1.714286
4 4.5 2.250000 1.714286
5 4.5 2.250000 1.714286
6 4.5 2.250000 1.714286
attractive_action_likert attractive_standing_likert realistic_action_likert
1 2.214286 1.178571 3.392857
2 2.607143 2.607143 2.964286
3 2.607143 2.607143 2.964286
4 2.607143 2.607143 2.964286
5 2.607143 2.607143 2.964286
6 2.607143 2.607143 2.964286
realistic_standing_likert AbsolutError SignedAngle..180 IQR RT
1 1.964286 NA NA NA NA
2 2.678571 34.308001 -34.308001 52.35318 16.368489
3 2.678571 83.069424 83.069424 52.35318 7.974188
4 2.678571 2.210407 2.210407 52.35318 8.858059
5 2.678571 30.482306 -30.482306 52.35318 6.429150
6 2.678571 5.407388 5.407388 52.35318 4.768045
DistanceToParticipant PointingTaskStartingLocations TrialNumber StartPointID
1 NA NA NA NA
2 263.1861 18 19 2
3 297.9136 7 274 23
4 173.0462 22 282 24
5 228.5974 12 293 25
6 273.0915 9 330 28
ID_for_StartingPosition avatarID AvatarPresenceCategory Context
1 NA NA
2 7 5 Omitted True
3 10 5 Present True
4 6 5 Present True
5 5 5 Present True
6 6 5 Omitted True
meaningfulBuilding ImageName
1
2 Meaningful 05_CmANo
3 Meaningful 05_CmA
4 Meaningful 05_CmA
5 Meaningful 05_CmA
6 Meaningful 05_CmANo
HumanA$ContextEffectf <-dplyr::recode(HumanA$Context,
False = -0.5, True= 0.5,
.default = NaN)
HumanA$AvatarPresenceEffectf <-dplyr::recode(HumanA$AvatarPresenceCategory,
Present = -0.5, Omitted= 0.5,
.default = NaN)
HumanA$ContextEffectf <-factor(HumanA$ContextEffectf,levels= c(-0.5, 0.5),
labels=c('Residential', 'Meaningful'))
HumanA$AvatarPresencef <-factor(HumanA$AvatarPresenceEffectf,
levels= c(-0.5, 0.5),
labels=c('Not displayed', 'displayed')) MainVariables <- subset(HumanA, select = c(AbsolutError, RT))
summary(MainVariables) AbsolutError RT
Min. : 0.00986 Min. : 1.061
1st Qu.: 12.43032 1st Qu.: 3.845
Median : 33.48641 Median : 6.438
Mean : 48.17395 Mean : 8.080
3rd Qu.: 71.75575 3rd Qu.:10.717
Max. :179.98339 Max. :29.366
NA's :4 NA's :4
summary(HumanA$AvatarPresenceEffectf) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
-0.500000 -0.500000 0.500000 0.000426 0.500000 0.500000 4
df = HumanA[complete.cases(HumanA),]
ggplot(df, aes(x=ContextEffectf, y=AbsolutError, fill=AvatarPresencef)) +
geom_boxplot(notch=TRUE,
notchwidth = 0.8,
outlier.colour="red",
outlier.fill="red",
outlier.size=0.5)ggplot(df, aes(x=ContextEffectf, y=RT, fill=AvatarPresencef)) +
geom_boxplot(notch=TRUE,
notchwidth = 0.8,
outlier.colour="red",
outlier.fill="red",
outlier.size=0.5)library(dplyr)
TwoFactorTable <- HumanA %>%
group_by(ContextEffectf, AvatarPresencef)%>%
summarise(AccuracyMean = mean(AbsolutError, na.rm = TRUE),
n=n(),
AccuracyStandardDev = sd(AbsolutError, na.rm = TRUE),
RTMean = mean(RT, na.rm = TRUE),
RTStandardDev = sd(RT, na.rm = TRUE))`summarise()` has grouped output by 'ContextEffectf'. You can override using
the `.groups` argument.
library(tidyr)
Attaching package: 'tidyr'
The following objects are masked from 'package:Matrix':
expand, pack, unpack
The following object is masked from 'package:dlookr':
extract
TwoFactorTableUnite <- TwoFactorTable %>%
unite("TwoFactor", ContextEffectf:AvatarPresencef, sep= " ", remove = F)
TwoFactorTableUnite <- TwoFactorTableUnite %>%
mutate( AccuracyStandardError=AccuracyStandardDev/sqrt(n)) %>%
mutate( AccuracyStandardIC=AccuracyStandardDev * qt((1-0.05)/2 + .5, n-1)) %>%
mutate( RTStandardError=RTStandardDev/sqrt(n)) Warning: Ignoring unknown aesthetics: linetype
Warning: Ignoring unknown aesthetics: linetype
df = HumanA[complete.cases(HumanA),]
df$AbsolutErrorR <- round(df$AbsolutError, digits = 3)
qqp(df$AbsolutErrorR, "norm")[1] 2613 968
qqp(df$AbsolutErrorR, "lnorm")[1] 2613 968
interceptOnly <-gls(AbsolutError ~ 1, data = df,
method = "ML")
IDrandomInterceptOnly <-lme(AbsolutError ~ 1, data = df,
random =~1|ID,
method = "ML")
StartlocationsrandomIntercept <-update(IDrandomInterceptOnly, .~.,
random=~1|ID/PointingTaskStartingLocations,
method= "ML")Including Id and starting position as random effects significantly improves the fit of the model
I am adding one main factor at a time
MeaningfulContext <-update(StartlocationsrandomIntercept, .~. + ContextEffectf)
summary(MeaningfulContext)Linear mixed-effects model fit by maximum likelihood
Data: df
AIC BIC logLik
90086.83 90122.2 -45038.42
Random effects:
Formula: ~1 | ID
(Intercept)
StdDev: 13.63238
Formula: ~1 | PointingTaskStartingLocations %in% ID
(Intercept) Residual
StdDev: 13.67445 40.87166
Fixed effects: AbsolutError ~ ContextEffectf
Value Std.Error DF t-value p-value
(Intercept) 50.85647 2.7933018 7984 18.206580 0.0000
ContextEffectfMeaningful -2.51541 0.9064463 7984 -2.775021 0.0055
Correlation:
(Intr)
ContextEffectfMeaningful -0.162
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.1474521 -0.6819886 -0.2313140 0.5171520 3.5682778
Number of Observations: 8713
Number of Groups:
ID PointingTaskStartingLocations %in% ID
26 728
Anova(MeaningfulContext)Analysis of Deviance Table (Type II tests)
Response: AbsolutError
Chisq Df Pr(>Chisq)
ContextEffectf 7.7025 1 0.005514 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Presence <-update(MeaningfulContext, .~. + AvatarPresencef)
summary(Presence)Linear mixed-effects model fit by maximum likelihood
Data: df
AIC BIC logLik
90087.93 90130.37 -45037.97
Random effects:
Formula: ~1 | ID
(Intercept)
StdDev: 13.63276
Formula: ~1 | PointingTaskStartingLocations %in% ID
(Intercept) Residual
StdDev: 13.66898 40.87023
Fixed effects: AbsolutError ~ ContextEffectf + AvatarPresencef
Value Std.Error DF t-value p-value
(Intercept) 51.28773 2.8302387 7983 18.121344 0.0000
ContextEffectfMeaningful -2.51960 0.9064670 7983 -2.779579 0.0055
AvatarPresencefdisplayed -0.85750 0.9039836 7983 -0.948584 0.3429
Correlation:
(Intr) CntxEM
ContextEffectfMeaningful -0.161
AvatarPresencefdisplayed -0.161 0.005
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.1528433 -0.6787017 -0.2308521 0.5148010 3.5789585
Number of Observations: 8713
Number of Groups:
ID PointingTaskStartingLocations %in% ID
26 728
Anova(Presence)Analysis of Deviance Table (Type II tests)
Response: AbsolutError
Chisq Df Pr(>Chisq)
ContextEffectf 7.7287 1 0.005435 **
AvatarPresencef 0.9001 1 0.342749
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TwofactorInteraction <-update(Presence, .~. + ContextEffectf*AvatarPresencef)
summary(TwofactorInteraction)Linear mixed-effects model fit by maximum likelihood
Data: df
AIC BIC logLik
90089.62 90139.13 -45037.81
Random effects:
Formula: ~1 | ID
(Intercept)
StdDev: 13.62651
Formula: ~1 | PointingTaskStartingLocations %in% ID
(Intercept) Residual
StdDev: 13.67257 40.86898
Fixed effects: AbsolutError ~ ContextEffectf + AvatarPresencef + ContextEffectf:AvatarPresencef
Value Std.Error DF
(Intercept) 51.54286 2.865440 7982
ContextEffectfMeaningful -3.02942 1.282282 7982
AvatarPresencefdisplayed -1.35775 1.268506 7982
ContextEffectfMeaningful:AvatarPresencefdisplayed 1.01262 1.801138 7982
t-value p-value
(Intercept) 17.987767 0.0000
ContextEffectfMeaningful -2.362520 0.0182
AvatarPresencefdisplayed -1.070352 0.2845
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.562209 0.5740
Correlation:
(Intr) CntxEM AvtrPr
ContextEffectfMeaningful -0.224
AvatarPresencefdisplayed -0.224 0.499
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.158 -0.707 -0.702
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.1599916 -0.6810744 -0.2312979 0.5155334 3.5727545
Number of Observations: 8713
Number of Groups:
ID PointingTaskStartingLocations %in% ID
26 728
Anova(TwofactorInteraction)Analysis of Deviance Table (Type II tests)
Response: AbsolutError
Chisq Df Pr(>Chisq)
ContextEffectf 7.7287 1 0.005435 **
AvatarPresencef 0.9001 1 0.342765
ContextEffectf:AvatarPresencef 0.3162 1 0.573886
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Pairwise<- emmeans(TwofactorInteraction, pairwise ~ ContextEffectf*AvatarPresencef)
Pairwise$emmeans
ContextEffectf AvatarPresencef emmean SE df lower.CL upper.CL
Residential Not displayed 51.5 2.87 25 45.6 57.4
Meaningful Not displayed 48.5 2.86 25 42.6 54.4
Residential displayed 50.2 2.86 25 44.3 56.1
Meaningful displayed 48.2 2.87 25 42.3 54.1
Degrees-of-freedom method: containment
Confidence level used: 0.95
$contrasts
contrast estimate SE df
Residential Not displayed - Meaningful Not displayed 3.029 1.28 7982
Residential Not displayed - Residential displayed 1.358 1.27 7982
Residential Not displayed - Meaningful displayed 3.375 1.28 7982
Meaningful Not displayed - Residential displayed -1.672 1.28 7982
Meaningful Not displayed - Meaningful displayed 0.345 1.28 7982
Residential displayed - Meaningful displayed 2.017 1.27 7982
t.ratio p.value
2.363 0.0845
1.070 0.7077
2.630 0.0426
-1.309 0.5573
0.269 0.9932
1.584 0.3879
Degrees-of-freedom method: containment
P value adjustment: tukey method for comparing a family of 4 estimates
plot(Pairwise[[2]], CIs = TRUE)library(multcomp);library(multcompView)Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Attaching package: 'TH.data'
The following object is masked from 'package:MASS':
geyser
CLD <- cld(Pairwise,
alpha=0.05,
Letters=letters,
adjust="sidak")I bet you wanted to call this with just object[[1]] - use '[[]]' or which' if I'm wrong.
See '? emm_list' for more information
ggplot(CLD,
aes(x = ContextEffectf,
y = emmean,
group = AvatarPresencef,
colours = .group)) +
geom_point(aes(shape=AvatarPresencef, linetype =AvatarPresencef), position=position_dodge(0.3)) +
geom_errorbar(aes(linetype=AvatarPresencef,
ymin = lower.CL,
ymax = upper.CL),
position=position_dodge(0.3),
width = 0.2,
size = 0.7) +
theme_bw() +
theme(axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
plot.caption = element_text(hjust = 0)) +
ylab("Estimated marginal mean\ Absolute angular error") +
xlab("Location Meaningfulness") +
ggtitle ("Marginal Means",
subtitle = "Meaningfulness * Presence") +
labs(caption = paste0(
"Boxes indicate the EM mean. \n",
"Error bars indicate the 95% ",
"confidence interval of the EM mean. \n"),
hjust=0.5) Warning: Ignoring unknown aesthetics: linetype
anova(interceptOnly, IDrandomInterceptOnly, StartlocationsrandomIntercept,
MeaningfulContext, Presence, TwofactorInteraction ) Model df AIC BIC logLik Test
interceptOnly 1 2 91151.27 91165.42 -45573.64
IDrandomInterceptOnly 2 3 90386.56 90407.77 -45190.28 1 vs 2
StartlocationsrandomIntercept 3 4 90092.53 90120.82 -45042.27 2 vs 3
MeaningfulContext 4 5 90086.83 90122.20 -45038.42 3 vs 4
Presence 5 6 90087.93 90130.37 -45037.97 4 vs 5
TwofactorInteraction 6 7 90089.62 90139.13 -45037.81 5 vs 6
L.Ratio p-value
interceptOnly
IDrandomInterceptOnly 766.7188 <.0001
StartlocationsrandomIntercept 296.0217 <.0001
MeaningfulContext 7.6986 0.0055
Presence 0.9000 0.3428
TwofactorInteraction 0.3162 0.5739
plot(TwofactorInteraction, which = 1)plot(MeaningfulContext, which = 1)GHQ <- glmer(AbsolutError ~ ContextEffectf*AvatarPresencef + (1|ID), data = HumanA,family=gaussian(link = "log"), nAGQ = 25) Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
summary(GHQ)Generalized linear mixed model fit by maximum likelihood (Adaptive
Gauss-Hermite Quadrature, nAGQ = 25) [glmerMod]
Family: gaussian ( log )
Formula: AbsolutError ~ ContextEffectf * AvatarPresencef + (1 | ID)
Data: HumanA
AIC BIC logLik deviance df.resid
16766820 16766863 -8383404 16766808 9378
Scaled residuals:
Min 1Q Median 3Q Max
-1.6944 -0.7128 -0.2587 0.4884 3.7236
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 238.1 15.43
Residual 1786.7 42.27
Number of obs: 9384, groups: ID, 28
Fixed effects:
Estimate Std. Error t value
(Intercept) 3.8495417 0.0690074 55.78
ContextEffectfMeaningful -0.0439444 0.0005743 -76.51
AvatarPresencefdisplayed -0.0209055 0.0005661 -36.93
ContextEffectfMeaningful:AvatarPresencefdisplayed -0.0050108 0.0008215 -6.10
Pr(>|z|)
(Intercept) < 2e-16 ***
ContextEffectfMeaningful < 2e-16 ***
AvatarPresencefdisplayed < 2e-16 ***
ContextEffectfMeaningful:AvatarPresencefdisplayed 1.06e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) CntxEM AvtrPr
CntxtEffctM -0.004
AvtrPrsncfd -0.004 0.486
CntxtEfM:AP 0.003 -0.699 -0.690
optimizer (Nelder_Mead) convergence code: 0 (OK)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Anova(GHQ)Analysis of Deviance Table (Type II Wald chisquare tests)
Response: AbsolutError
Chisq Df Pr(>Chisq)
ContextEffectf 12764.585 1 < 2.2e-16 ***
AvatarPresencef 3227.439 1 < 2.2e-16 ***
ContextEffectf:AvatarPresencef 37.204 1 1.064e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(GHQ)Analysis of Variance Table
npar Sum Sq Mean Sq F value
ContextEffectf 1 12731.3 12731.3 7.1255
AvatarPresencef 1 3234.7 3234.7 1.8104
ContextEffectf:AvatarPresencef 1 37.2 37.2 0.0208
emmeans(GHQ, pairwise ~ ContextEffectf:AvatarPresencef, type = "response")$emmeans
ContextEffectf AvatarPresencef response SE df asymp.LCL asymp.UCL
Residential Not displayed 47.0 3.24 Inf 41.0 53.8
Meaningful Not displayed 45.0 3.10 Inf 39.3 51.5
Residential displayed 46.0 3.17 Inf 40.2 52.7
Meaningful displayed 43.8 3.02 Inf 38.3 50.1
Confidence level used: 0.95
Intervals are back-transformed from the log scale
$contrasts
contrast ratio SE df null
Residential Not displayed / Meaningful Not displayed 1.0449 0.0006001 Inf 1
Residential Not displayed / Residential displayed 1.0211 0.0005781 Inf 1
Residential Not displayed / Meaningful displayed 1.0724 0.0006250 Inf 1
Meaningful Not displayed / Residential displayed 0.9772 0.0005652 Inf 1
Meaningful Not displayed / Meaningful displayed 1.0263 0.0006105 Inf 1
Residential displayed / Meaningful displayed 1.0502 0.0006168 Inf 1
z.ratio p.value
76.513 <.0001
36.929 <.0001
119.859 <.0001
-39.831 <.0001
43.567 <.0001
83.348 <.0001
P value adjustment: tukey method for comparing a family of 4 estimates
Tests are performed on the log scale
plot(fitted(GHQ), residuals(GHQ), xlab = "Fitted Values", ylab = "Residuals")
abline(h = 0, lty = 2)
lines(smooth.spline(fitted(GHQ), residuals(GHQ)))interceptOnly <-gls(log(AbsolutError) ~ 1, data = df,
method = "ML")
IDrandomInterceptOnly <-lme(log(AbsolutError) ~ 1, data = df,
random =~1|ID,
method = "ML")
StartlocationsrandomIntercept <-update(IDrandomInterceptOnly, .~.,
random=~1|ID/PointingTaskStartingLocations,
method= "ML")
MeaningfulContext <-update(StartlocationsrandomIntercept, .~. + ContextEffectf)
Presence <-update(MeaningfulContext, .~. + AvatarPresencef)
TwofactorInteraction <-update(Presence, .~. + ContextEffectf*AvatarPresencef)
summary(TwofactorInteraction)Linear mixed-effects model fit by maximum likelihood
Data: df
AIC BIC logLik
29477.89 29527.39 -14731.94
Random effects:
Formula: ~1 | ID
(Intercept)
StdDev: 0.4164366
Formula: ~1 | PointingTaskStartingLocations %in% ID
(Intercept) Residual
StdDev: 0.3017131 1.27877
Fixed effects: log(AbsolutError) ~ ContextEffectf + AvatarPresencef + ContextEffectf:AvatarPresencef
Value Std.Error DF
(Intercept) 3.376591 0.08706463 7982
ContextEffectfMeaningful -0.133322 0.03971070 7982
AvatarPresencefdisplayed -0.064008 0.03939877 7982
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.045421 0.05590503 7982
t-value p-value
(Intercept) 38.78258 0.0000
ContextEffectfMeaningful -3.35733 0.0008
AvatarPresencefdisplayed -1.62461 0.1043
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.81247 0.4165
Correlation:
(Intr) CntxEM AvtrPr
ContextEffectfMeaningful -0.229
AvatarPresencefdisplayed -0.229 0.501
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.162 -0.707 -0.703
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.8952344 -0.4486963 0.1935546 0.6817025 2.2375048
Number of Observations: 8713
Number of Groups:
ID PointingTaskStartingLocations %in% ID
26 728
Anova(TwofactorInteraction)Analysis of Deviance Table (Type II tests)
Response: log(AbsolutError)
Chisq Df Pr(>Chisq)
ContextEffectf 15.5081 1 8.215e-05 ***
AvatarPresencef 2.1956 1 0.1384
ContextEffectf:AvatarPresencef 0.6604 1 0.4164
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Pairwise<- emmeans(TwofactorInteraction, pairwise ~ ContextEffectf*AvatarPresencef, type='response')
Pairwise $emmeans
ContextEffectf AvatarPresencef response SE df lower.CL upper.CL
Residential Not displayed 29.3 2.55 25 24.5 35.0
Meaningful Not displayed 25.6 2.23 25 21.4 30.6
Residential displayed 27.5 2.39 25 23.0 32.8
Meaningful displayed 25.1 2.19 25 21.0 30.1
Degrees-of-freedom method: containment
Confidence level used: 0.95
Intervals are back-transformed from the log scale
$contrasts
contrast ratio SE df null
Residential Not displayed / Meaningful Not displayed 1.143 0.0454 7982 1
Residential Not displayed / Residential displayed 1.066 0.0420 7982 1
Residential Not displayed / Meaningful displayed 1.164 0.0463 7982 1
Meaningful Not displayed / Residential displayed 0.933 0.0369 7982 1
Meaningful Not displayed / Meaningful displayed 1.019 0.0405 7982 1
Residential displayed / Meaningful displayed 1.092 0.0431 7982 1
t.ratio p.value
3.357 0.0044
1.625 0.3647
3.817 0.0008
-1.754 0.2957
0.468 0.9661
2.225 0.1166
Degrees-of-freedom method: containment
P value adjustment: tukey method for comparing a family of 4 estimates
Tests are performed on the log scale
plot(Pairwise[[2]])anova(interceptOnly, IDrandomInterceptOnly, StartlocationsrandomIntercept,
MeaningfulContext, Presence, TwofactorInteraction ) Model df AIC BIC logLik Test
interceptOnly 1 2 30340.42 30354.56 -15168.21
IDrandomInterceptOnly 2 3 29586.02 29607.24 -14790.01 1 vs 2
StartlocationsrandomIntercept 3 4 29490.14 29518.44 -14741.07 2 vs 3
MeaningfulContext 4 5 29476.74 29512.10 -14733.37 3 vs 4
Presence 5 6 29476.55 29518.98 -14732.27 4 vs 5
TwofactorInteraction 6 7 29477.89 29527.39 -14731.94 5 vs 6
L.Ratio p-value
interceptOnly
IDrandomInterceptOnly 756.3928 <.0001
StartlocationsrandomIntercept 97.8778 <.0001
MeaningfulContext 15.4029 0.0001
Presence 2.1953 0.1384
TwofactorInteraction 0.6602 0.4165
plot(TwofactorInteraction, which = 1)model <- glmmPQL(RT ~ ContextEffectf*AvatarPresencef, ~1|ID/PointingTaskStartingLocations, family = gaussian(link = "log"), data = HumanA, verbose = FALSE)
summary(model)Linear mixed-effects model fit by maximum likelihood
Data: HumanA
AIC BIC logLik
NA NA NA
Random effects:
Formula: ~1 | ID
(Intercept)
StdDev: 0.2231925
Formula: ~1 | PointingTaskStartingLocations %in% ID
(Intercept) Residual
StdDev: 0.2224999 4.923456
Variance function:
Structure: fixed weights
Formula: ~invwt
Fixed effects: RT ~ ContextEffectf * AvatarPresencef
Value Std.Error DF
(Intercept) 2.0548868 0.04477158 8597
ContextEffectfMeaningful 0.0017300 0.01749219 8597
AvatarPresencefdisplayed 0.0110505 0.01718929 8597
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.0217719 0.02441735 8597
t-value p-value
(Intercept) 45.89712 0.0000
ContextEffectfMeaningful 0.09890 0.9212
AvatarPresencefdisplayed 0.64287 0.5203
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.89166 0.3726
Correlation:
(Intr) CntxEM AvtrPr
ContextEffectfMeaningful -0.195
AvatarPresencefdisplayed -0.197 0.499
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.138 -0.715 -0.700
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.2369429 -0.6791802 -0.3101101 0.3731269 4.3832247
Number of Observations: 9384
Number of Groups:
ID PointingTaskStartingLocations %in% ID
28 784
df = HumanA[complete.cases(HumanA),]
df$RTr <- round(df$RT, digits = 3)
qqp(df$RT, "norm")[1] 8633 8491
qqp(df$RT, "lnorm")[1] 8633 8491
interceptOnlyt <-gls(log(RT) ~ 1, data = df,
method = "ML")
IDrandomInterceptOnlyt <-lme(log(RT) ~ 1, data = df,
random =~1|ID,
method = "ML")
StartlocationsrandomInterceptt <-lme(log(RT) ~ 1, data = df,
random=~1|ID|PointingTaskStartingLocations,
method= "ML")
MeaningfulContext <-update(StartlocationsrandomInterceptt, .~. + ContextEffectf)
Presence <-update(MeaningfulContext, .~. + AvatarPresencef)
TwofactorInteraction <-update(Presence, .~. + ContextEffectf*AvatarPresencef)
summary(TwofactorInteraction)Linear mixed-effects model fit by maximum likelihood
Data: df
AIC BIC logLik
18247.11 18303.69 -9115.555
Random effects:
Formula: ~1 | ID | PointingTaskStartingLocations
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.08246629 (Intr)
1 | IDTRUE 0.08246629 -0.587
Residual 0.68713429
Fixed effects: log(RT) ~ ContextEffectf + AvatarPresencef + ContextEffectf:AvatarPresencef
Value Std.Error DF
(Intercept) 1.8224232 0.02051489 8682
ContextEffectfMeaningful 0.0195495 0.02088165 8682
AvatarPresencefdisplayed 0.0228840 0.02082944 8682
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.0168581 0.02949335 8682
t-value p-value
(Intercept) 88.83418 0.0000
ContextEffectfMeaningful 0.93620 0.3492
AvatarPresencefdisplayed 1.09864 0.2720
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.57159 0.5676
Correlation:
(Intr) CntxEM AvtrPr
ContextEffectfMeaningful -0.514
AvatarPresencefdisplayed -0.515 0.505
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.363 -0.707 -0.706
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.689589261 -0.748955546 -0.002091011 0.739456135 2.353193766
Number of Observations: 8713
Number of Groups: 28
Anova(TwofactorInteraction)Analysis of Deviance Table (Type II tests)
Response: log(RT)
Chisq Df Pr(>Chisq)
ContextEffectf 3.5895 1 0.05815 .
AvatarPresencef 4.5065 1 0.03377 *
ContextEffectf:AvatarPresencef 0.3269 1 0.56751
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Pairwiset<- emmeans(TwofactorInteraction, pairwise ~ ContextEffectf*AvatarPresencef, type='response')
Pairwiset $emmeans
ContextEffectf AvatarPresencef response SE df lower.CL upper.CL
Residential Not displayed 6.19 0.127 27 5.93 6.45
Meaningful Not displayed 6.31 0.129 27 6.05 6.58
Residential displayed 6.33 0.129 27 6.07 6.60
Meaningful displayed 6.56 0.135 27 6.29 6.85
Degrees-of-freedom method: containment
Confidence level used: 0.95
Intervals are back-transformed from the log scale
$contrasts
contrast ratio SE df null
Residential Not displayed / Meaningful Not displayed 0.981 0.0205 8682 1
Residential Not displayed / Residential displayed 0.977 0.0204 8682 1
Residential Not displayed / Meaningful displayed 0.942 0.0198 8682 1
Meaningful Not displayed / Residential displayed 0.997 0.0207 8682 1
Meaningful Not displayed / Meaningful displayed 0.961 0.0201 8682 1
Residential displayed / Meaningful displayed 0.964 0.0201 8682 1
t.ratio p.value
-0.936 0.7854
-1.099 0.6904
-2.823 0.0246
-0.161 0.9985
-1.904 0.2265
-1.745 0.3006
Degrees-of-freedom method: containment
P value adjustment: tukey method for comparing a family of 4 estimates
Tests are performed on the log scale
ref_grid(TwofactorInteraction)'emmGrid' object with variables:
ContextEffectf = Residential, Meaningful
AvatarPresencef = Not displayed, displayed
Transformation: "log"
plot(Pairwiset[[2]])anova(interceptOnlyt, IDrandomInterceptOnlyt, StartlocationsrandomInterceptt,
MeaningfulContext, Presence, TwofactorInteraction ) Model df AIC BIC logLik Test
interceptOnlyt 1 2 18303.41 18317.55 -9149.703
IDrandomInterceptOnlyt 2 3 16981.94 17003.16 -8487.971 1 vs 2
StartlocationsrandomInterceptt 3 5 18249.43 18284.79 -9119.716 2 vs 3
MeaningfulContext 4 6 18247.94 18290.38 -9117.971 3 vs 4
Presence 5 7 18245.44 18294.94 -9115.719 4 vs 5
TwofactorInteraction 6 8 18247.11 18303.69 -9115.555 5 vs 6
L.Ratio p-value
interceptOnlyt
IDrandomInterceptOnlyt 1323.4635 <.0001
StartlocationsrandomInterceptt 1263.4883 <.0001
MeaningfulContext 3.4887 0.0618
Presence 4.5052 0.0338
TwofactorInteraction 0.3268 0.5676
plot(TwofactorInteraction, which = 1)CLD <- cld(Pairwiset,
alpha=0.05,
Letters=letters,
adjust="sidak")I bet you wanted to call this with just object[[1]] - use '[[]]' or which' if I'm wrong.
See '? emm_list' for more information
ggplot(CLD,
aes(x = ContextEffectf,
y = response,
group = AvatarPresencef,
colours = .group)) +
geom_point(aes(shape=AvatarPresencef, color=AvatarPresencef), position=position_dodge(0.3)) +
geom_errorbar(aes(color=AvatarPresencef,
ymin = lower.CL,
ymax = upper.CL),
position=position_dodge(0.3),
width = 0.2,
size = 0.7) +
theme_bw() +
theme(axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
plot.caption = element_text(hjust = 0)) +
ylab("Estimated marginal mean\ Response Time in Seconds") +
xlab("Location Meaningfulness") +
ggtitle ("Marginal Means",
subtitle = "Meaningfulness * Presence") +
labs(caption = paste0(
"Boxes indicate the EM mean. \n",
"Error bars indicate the 95% ",
"confidence interval of the EM mean. \n"),
hjust=0.5) GHQ <- glmer(RT ~ ContextEffectf*AvatarPresencef + (1|ID), data = HumanA,
family=gaussian(link = "log"), nAGQ = 25)
summary(GHQ)Generalized linear mixed model fit by maximum likelihood (Adaptive
Gauss-Hermite Quadrature, nAGQ = 25) [glmerMod]
Family: gaussian ( log )
Formula: RT ~ ContextEffectf * AvatarPresencef + (1 | ID)
Data: HumanA
AIC BIC logLik deviance df.resid
262057.8 262100.7 -131022.9 262045.8 9378
Scaled residuals:
Min 1Q Median 3Q Max
-1.9259 -0.6951 -0.2851 0.4426 4.0698
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 1.581 1.257
Residual 27.904 5.282
Number of obs: 9384, groups: ID, 28
Fixed effects:
Estimate Std. Error t value
(Intercept) 2.0602890 0.0450614 45.722
ContextEffectfMeaningful -0.0155728 0.0035564 -4.379
AvatarPresencefdisplayed 0.0009492 0.0035211 0.270
ContextEffectfMeaningful:AvatarPresencefdisplayed 0.0337878 0.0049858 6.777
Pr(>|z|)
(Intercept) < 2e-16 ***
ContextEffectfMeaningful 1.19e-05 ***
AvatarPresencefdisplayed 0.787
ContextEffectfMeaningful:AvatarPresencefdisplayed 1.23e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) CntxEM AvtrPr
CntxtEffctM -0.040
AvtrPrsncfd -0.040 0.510
CntxtEfM:AP 0.028 -0.714 -0.707
Anova(GHQ)Analysis of Deviance Table (Type II Wald chisquare tests)
Response: RT
Chisq Df Pr(>Chisq)
ContextEffectf 0.4341 1 0.51
AvatarPresencef 51.3014 1 7.922e-13 ***
ContextEffectf:AvatarPresencef 45.9252 1 1.229e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(GHQ)Analysis of Variance Table
npar Sum Sq Mean Sq F value
ContextEffectf 1 0.358 0.358 0.0128
AvatarPresencef 1 51.465 51.465 1.8444
ContextEffectf:AvatarPresencef 1 45.999 45.999 1.6485
emmeans(GHQ, pairwise ~ ContextEffectf:AvatarPresencef )$emmeans
ContextEffectf AvatarPresencef emmean SE df asymp.LCL asymp.UCL
Residential Not displayed 2.06 0.0451 Inf 1.97 2.15
Meaningful Not displayed 2.04 0.0451 Inf 1.96 2.13
Residential displayed 2.06 0.0451 Inf 1.97 2.15
Meaningful displayed 2.08 0.0451 Inf 1.99 2.17
Results are given on the log (not the response) scale.
Confidence level used: 0.95
$contrasts
contrast estimate SE df
Residential Not displayed - Meaningful Not displayed 0.015573 0.00356 Inf
Residential Not displayed - Residential displayed -0.000949 0.00352 Inf
Residential Not displayed - Meaningful displayed -0.019164 0.00354 Inf
Meaningful Not displayed - Residential displayed -0.016522 0.00350 Inf
Meaningful Not displayed - Meaningful displayed -0.034737 0.00352 Inf
Residential displayed - Meaningful displayed -0.018215 0.00349 Inf
z.ratio p.value
4.379 0.0001
-0.270 0.9932
-5.419 <.0001
-4.715 <.0001
-9.856 <.0001
-5.220 <.0001
Results are given on the log (not the response) scale.
P value adjustment: tukey method for comparing a family of 4 estimates